import java.util.concurrent.Semaphore;

public class Demo1 {
    //信号量的使用信
    public static void main(String[] args) throws InterruptedException {
        Semaphore semaphore = new Semaphore(3);

        //P操作申请资源
        semaphore.acquire();
        semaphore.acquire();
        semaphore.acquire();
        semaphore.acquire();

        //V操作释放资源
        semaphore.release();
        semaphore.release();
        semaphore.release();

    }
}
